import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '@/components/index.vue'
import warehouseList from '@/components/warehouseList.vue'
import Orders from '@/components/orders.vue'
import AddWarehouse from '@/components/AddWarehouse.vue'
import WarehouseDetails from '@/components/WarehouseDetails.vue'
import GoodsList from '@/components/GoodsList.vue'
import GoodsTypeList from '@/components/GoodsTypeList.vue'
import RoleInformation from '@/components/RoleInformation.vue'
import characterInformation from '@/components/characterInformation.vue'
import Sorting from '@/components/Sorting.vue'
import OrderItem from '@/components/orderItem.vue'
import Timesale from '@/components/timesale.vue'
import TimesaleItem from '@/components/timesaleItem.vue'
import Delivery from '@/components/Delivery.vue'
import AccountInfo from '../components/AccountInfo.vue'
import ChangePassword from '../components/ChangePassword.vue'
import Login from '../components/Login.vue'
Vue.use(VueRouter)

const routes = [
  { path: '/', name: 'login', component: Login},
  {
    path: "/index",
    name: "index",
    component: index,
    children: [
      { path: 'warehouseList', name: 'warehouseList', component: warehouseList},
      { path: 'AddWarehouse',name: 'AddWarehouse', component: AddWarehouse},
      { path: 'WarehouseDetails',name: 'WarehouseDetails', component: WarehouseDetails},
      { path: '/orders', name: 'orders', component: Orders },
      { path: 'GoodsList', name: 'GoodsList', component: GoodsList },
      { path: 'GoodsTypeList', name: 'GoodsTypeList', component: GoodsTypeList },
      { path: '/RoleInformation', name: 'RoleInformation', component: RoleInformation },
      { path: '/characterInformation', name: 'characterInformation', component: characterInformation },
      { path: 'Sorting', name: 'Sorting', component: Sorting },
      { path: "/orderItem", name: "orderItem", component: OrderItem },
      { path: "/timesale", name: "timesale", component: Timesale },
      {
        path: "/timesaleItem/create",
        name: "timesaleItem-create",
        component: TimesaleItem,
        props: { mode: "create" },
        meta: { title: "新增数据", operation: "create" }
      },
      {
        path: "/timesaleItem/:saleId",
        name: "timesaleItem-view",
        component: TimesaleItem,
        props: (route) => ({ 'saleId': route.query.saleId, 'saleStatus': route.query.saleStatus, mode: "view" }),
        meta: { title: "查看数据", operation: "view" }
      },
      { path: "/Delivery", name: "Delivery", component: Delivery },
      {
        path: '/account-info',
        name: 'AccountInfo',
        component: AccountInfo
      },
      {
        path: '/change-password',
        name: 'ChangePassword',
        component: ChangePassword
      }
    ]
  }
]
const router = new VueRouter({
  routes
})

export default router
